import { SplitType } from '@prisma/client';
import {
  Baby,
  Backpack,
  Banknote,
  Bike,
  Bone,
  Bus,
  Car,
  CarTaxiFront,
  Construction,
  DollarSign,
  DoorOpen,
  FerrisWheel,
  Flame,
  Fuel,
  Gamepad2,
  Gift,
  GlassWater,
  Globe,
  GraduationCap,
  Hammer,
  HandCoins,
  HandIcon,
  Home,
  Hotel,
  type LucideIcon,
  type LucideProps,
  Music,
  Paintbrush,
  Paintbrush2,
  ParkingCircle,
  Phone,
  Pizza,
  Plane,
  Plug,
  Popcorn,
  ReceiptText,
  Shield,
  Shirt,
  ShoppingCart,
  Sofa,
  Sprout,
  Stethoscope,
  TrainFront,
  Trash,
  Trophy,
  Utensils,
  Wine,
  Wrench,
  Zap,
} from 'lucide-react';

import { type CategoryItem, DEFAULT_CATEGORY } from '~/lib/category';

export const CategoryIcons: Record<CategoryItem, LucideIcon> = {
  games: Gamepad2,
  movies: Popcorn,
  music: Music,
  sports: Trophy,
  entertainment: FerrisWheel,
  food: Pizza,
  diningOut: Utensils,
  groceries: ShoppingCart,
  liquor: Wine,
  home: Home,
  electronics: Plug,
  furniture: Sofa,
  supplies: Paintbrush2,
  maintenance: Construction,
  mortgage: HandIcon,
  pets: Bone,
  rent: DoorOpen,
  services: Hammer,
  life: Sprout,
  childcare: Baby,
  clothing: Shirt,
  education: GraduationCap,
  gifts: Gift,
  medical: Stethoscope,
  taxes: ReceiptText,
  travel: Backpack,
  bus: Bus,
  train: TrainFront,
  car: Car,
  fuel: Fuel,
  parking: ParkingCircle,
  plane: Plane,
  taxi: CarTaxiFront,
  utilities: Wrench,
  electricity: Zap,
  gas: Flame,
  internet: Globe,
  phone: Phone,
  water: GlassWater,
  general: Banknote,
  cleaning: Paintbrush,
  trash: Trash,
  insurance: Shield,
  bicycle: Bike,
  hotel: Hotel,
};

export const CURRENCY_CONVERSION_ICON = DollarSign;

export const SETTLEUP_ICON = HandCoins;

export const DEFAULT_CATEGORY_ICON = CategoryIcons[DEFAULT_CATEGORY];

export const CategoryIcon: React.FC<{ category?: string; splitType?: SplitType } & LucideProps> = ({
  category = DEFAULT_CATEGORY,
  ...props
}) => {
  const Icon = CategoryIcons[category as CategoryItem] ?? DEFAULT_CATEGORY_ICON;

  return <Icon {...props} />;
};
